package com.xpjhs.user.model;

import java.io.Serializable;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public  class ShiroUser implements Serializable {
	private static final long serialVersionUID = -1373760761780840081L;
	
	
	private String username;
	private String realname;
	private String icon;
	

	public String getUsername() {
		return username;
	}
	public String getRealname() {
		return realname;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setRealname(String realname) { 
		this.realname = realname;
	}

	public ShiroUser(String username, String realname) {
		this.username = username;
		this.realname = realname;
	}

	
	public ShiroUser(String username, String realname,String icon) {
		this.username = username;
		this.realname = realname;
		this.icon = icon;
	}



	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	/**
	 * 本函数输出将作为默认的<shiro:principal/>输出.
	 */
	@Override
	public String toString() {
		return username;
	}

	/**
	 * 重载equals,只计算loginName;
	 */
	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this, "username");
	}

	/**
	 * 重载equals,只比较loginName
	 */
	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj, "username");
	}

}